home *** CD-ROM | disk | FTP | other *** search
Text File | 1992-09-13 | 12.4 KB | 313 lines | [TEXT/ttxt] |
- Swoop v0.1 beta
- by Douglas Otwell
-
- User Guide and Reference
-
-
- WARNING: Swoop v0.1b is a BETA version of the program. Therefore it
- can be expected to have bugs and rough spots. By using this
- program, you will have become a beta tester.
-
-
-
- TABLE OF CONTENTS
- =================
- 1. Overview
- 2. Disclaimer
- 3. Run Instructions
- 4. Application Notes
- 5. Acknowledgements
- 6. Contacting the Author
-
-
-
- 1. OVERVIEW
- ============
-
- Requirements: Swoop requires POV-Ray to render the resulting object.
- Swoop requires the utility Raw2POV, by Steve Anger, to
- convert Swoop output into POV-Ray input.
- Polyray, by Alexander Enzmann, is not required, but
- is very useful as a previewer.
-
- Swoop is a little utility I've been developing to create objects for the
- POV-Ray raytracer. POV-Ray is a raytracer originally written by David Buck,
- and substantially enhanced by the POV team, lead by Drew Wells.
-
- Swoop creates swoop surfaces, using a collection of POV-Ray triangle
- primitives. A swoop surface is like a sweep surface, with a twist. Swoop
- surfaces are created by sweeping a two-dimensional polygon through space,
- in a pre-defined path, and connecting the sides of the polygon with
- triangles, resulting in a tube-like object with a cross-section of the
- original polygon. Extrusions can be done by translating the polygon in a
- straight line. Surfaces of rotation are done by sweeping the polygon in
- a circle. More complex shapes can be made by combining translations,
- rotations, and scaling of the polygon while it is being swept (or swoopt.)
-
- Swoop generates raw triangle data only. Swoop relies on a gem of a program
- written by Steve Anger called Raw2POV. This program takes raw triangle
- data, generated by Swoop or other means, and smooths and bounds and formats
- the data for use by POV-Ray.
-
- Swoop is executed from the command line, and reads an ascii text file for its
- parameters. No preview mode is available. Swoop has basic abilities to
- output Polyray data. Polyray is another raytracer, written by
- Alexander Enzmann. For these purposes, its distinguishing characteristic is
- a "scan conversion" mode, which is very very quick at rendering the Swoop
- output, and therefore I use it as a previewer. (Polyray is a sophisticated
- and powerful raytracer in its own right.)
-
-
-
- DISCLAIMER
- ==========
- This program is offered as is, with no warranties, expressed or implied,
- regarding its correctness or suitability. I will not be responsible for any
- damage this program may cause to your data, software, hardware or social life.
-
-
- 3. RUN INSTRUCTIONS
- ====================
-
- 3.1 Creating the Swoop Input File
- ----------------------------------
- The swoop input file is an ascii text file created with your favorite text
- editor. Let's start with an example to see how this works.
- In this example, we're beginning with a 2-unit square in the y-z plane, and
- we're going to extrude it by sweeping it from left to right. Just for kicks,
- we want to twist it a half turn as we sweep.
- The input file will look like the following. (This is from the included
- file EXAMPLE1.TXT. The results can be seen in the top left corner of
- EXAMPLES.GIF.)
-
-
- outfile test.inc
- name example1
- output_type 1
- segments 30
-
- vertex 0 1 1
- vertex 0 1 -1
- vertex 0 -1 -1
- vertex 0 -1 1
-
- var 1 0 180
- var 1 -5 5
-
- rotate &1 0 0
- translate &2 0 0
-
-
- The first section of this example contains keywords describing the
- object we're creating: the output file name, name of the object, the type
- of output (raw or Polyray syntax), and the total number of segments to create.
-
- The next section lists the vertices of the polygon. Up to 24 vertices are
- allowed; Swoop will always connect the last to the first to close the
- polygon.
-
- The third section defines the variables that will be used. Currently only
- straight-line variables are allowed. You specify a start and stop value,
- and Swoop will interpolate those values for each segment of the surface.
-
- The final section describes the path that will be swept out by the polygon.
- It consists of up to 24 transformations (translate, rotate, or scale)
- that will be done on the polygon for each segment. The arguments may be
- constants, or may be the result of interpolating one of the variables
- described in the previous section. For variable arguments, a &n is used,
- where n references the var definition; 1=first, 2=second, etc.
-
- In the example above, we are going to rotate the square around the x-axis
- using variable definition #1 (from 0 to 180).
- At the same time, we'll translate the square from -5 to 5 on the x-axis,
- using the second variable definition.
-
- The swoop object is formed by connecting each side of the polygon with the
- same side of the new, transformed polygon, using two triangles. The
- smoothness of the resulting polyhedron can be adjusted by using more or fewer
- sides, and more or fewer segments.
-
- For more information on each keyword, see the Swoop Keywords section, below.
-
- 3.2 Running Swoop
- ------------------
-
- Once your input file is created, produce the output file by calling Swoop
- from the command-line, and specifying the full name of the input file, e.g.:
-
- Swoop example1.txt
-
- A file will be created with the name and format specified in the input file.
-
- WARNING: any existing file with the name specified by the outfile keyword
- will be overwritten without warning.
-
- Three command-line switches are provided to override settings in the input
- file:
-
- -ofilename will override the output file name to filename
- -p will force Polyray output
- -r will force raw triangle output
-
- 3.3 Previewing with Polyray
- ----------------------------
-
- If you specified Polyray output (output_type 1), you'll next want to run
- Polyray. A sample Polyray input file, TEST.PI, is included in this
- distribution. You'll need to change the #include line to specify the
- file you created with Swoop, and replace the word "test" inside the object
- description with the name you specified for your object. You will probably
- also have to adjust the camera position and look_at. Then:
-
- Polyray test.pi -V1 -W -S
-
- will display the object on screen in VGA mode, and write a sixteen-bit
- targa file called OUT.TGA.
-
- For details on running Polyray, consult the Polyray documentation.
-
- 3.4 Running Raw Data Through Raw2POV
- -------------------------------------
-
- If you created raw triangle data with Swoop, you'll need to run it through
- Raw2POV before POV-Ray can make use of it. Raw2POV does all the hard work
- of calculating normals, and bounding and formatting the triangles to produce
- smooth triangle primitives for POV-Ray. The results look spectacular and
- trace quite quickly. The command line will look like:
-
- raw2pov example1.raw -s180
-
- The -s180 will smooth all triangles. Omit this if you don't want smoothing
- done.
-
- Raw2POV creates two files; EXAMPLE1.INC, containing the POV-Ray triangle data,
- and EXAMPLE1.POV, which has the texture definitions, the composite
- definition with the #include example1.inc, and an overall bounding box. This
- is the file you will want to insert into your POV-Ray scene file.
-
- Swoop creates a separate object for each face of the swoop surface. Raw2POV
- will combine these into a single composite definition and create a texture
- for each surface. See the Application Notes for more details.
-
- For details on running Raw2POV, consult the Raw2POV documentation.
-
- 3.5 Running POV-Ray
- --------------------
-
- After splicing in example1.pov into your POV-Ray data file, run POV-Ray as
- you normally would. Be forewarned; smooth triangles parse slowly, and can
- require large amounts of RAM.
-
- 3.6 Swoop Keywords
- --------
-
- This section contains details for each keyword that Swoop understands.
-
-
- outfile This specifies the name of the file that Swoop will write its
- ------- triangle data to. A complete path may be specified. This
- file will be overwritten if it already exists.
-
- name Use this to assign a name to the objects you create. In raw
- ---- mode, Swoop will create a separate object for each face of
- the swoop. They will be named name_side1, name_side2, etc.
- If name is not specified, it will default to "swoop."
-
- output_type This indicates the format of the output: 1 = Polyray, 2 = raw.
- -----------
-
- segments Specifies the number of segments Swoop will generate. The
- -------- total number of triangles generated is #segments * #sides * 2.
-
- vertex This keyword specifies a polygon vertex. The order in which
- ------ vertices are specified is important. To create triangles with
- their normals pointing outward (which is what you want,) the
- polygon vertices must be specified in the proper order. To
- determine this, take your _right_ hand and point your thumb
- in the direction that the polygon will be swept in. Then your
- fingers will curl in the direction in which the vertices must be
- specified. If your swoop surface turns out very dark, you
- probably have the vertices in the wrong order.
-
- var This is the variable definition. The first argument specifies
- --- the variable type. Currently only type 1, linear variables, are
- implemented. The next two arguments are the start and stop
- values. The value of the variable will range from the first value
- to the second.
-
- rotate The rotate keyword specifies that the polygon is to be rotated
- ------ between each segment. Three arguments specify rotation around
- the x, y, and z axes, just as with POV-Ray. Use it to create
- surfaces of revolution, or combine it with other transforms for
- other effects. Rotation is done around the "world" origin.
-
- translate Translate is used, obviously, to translate the polygon. It can
- --------- be used to create extrusions or more complex shapes.
-
- scale The polygon may be scaled as it is being swept. As with POV-Ray
- ----- scaling is done around the "world" origin.
-
-
- 4. Application Notes
- =====================
-
- Included in this distribution are four example swoop input files:
- EXAMPLE1.TXT through EXAMPLE4.TXT. The results of these, created by
- Polyray, are included as EXAMPLES.GIF.
-
- All the example files use simple, regular polygons. Don't be limited. Use
- graph paper to layout your own complex polygons.
-
- The temptation is to use more segments than needed to get a smooth look.
- Start small, and add segments if needed.
-
- Swoop creates each face of the swoop surface as a separate object. This
- allows you to color each face separately. More importantly, it gives you
- control over how your swoops are smoothed. Normally faces are not smoothed
- together, resulting in sharp edges that follow the corners of the polygon.
- If you want to smooth these edges, use a text editor to delete the lines
- in yourfile.raw that specify a new object name, eg: "name_side1". You can
- selectively smooth sides together by deleting specific side names.
-
- Swoop makes no attempt to prevent degenerate triangles (triangles with
- duplicated or co-linear vertices.) Polyray and Raw2POV both seem to
- handle these gracefully.
-
- The source code for Swoop is included in the distribution. For a time, I
- will be coordinating changes and new releases of Swoop. I ask that any ideas
- or code enhancements you have, you send to me for inclusion in the next
- release. See the following section on Contacting the Author.
-
-
- 5. Acknowledgements
- ====================
-
- First and foremost I want to thank David Buck, original author of the DKBTrace
- raytracer that is the basis of POV-Ray. Then Drew Wells and the POV team,
- who have made substantial enhancements to that program.
-
- Thanks also to Steve Anger for Raw2POV, which makes possible any number of
- nifty triangle generators for POV-Ray, written by hacks like myself.
-
- And thanks to Alexander Enzmann for Polyray and its scan conversion feature.
-
- Raw2POV and Polyray can be found in the COMART forum on CompuServe, or on
- the You Can Call Me Ray bulletin board.
-
- 6. Contacting the Author
- =========================
-
- I am very interested in hearing your comments and suggestions regarding
- Swoop or raytrace graphics in general. I'm also interested in seeing how you
- make use of Swoop. You can usually find me lurking on the following
- BBSs:
-
- Compuserve GO COMART 76236,1121
- You Can Call Me Ray BBS 708-358-5611 Douglas Otwell
-
- or write me at:
-
- Douglas Otwell
- 2750 Hurd Ave
- Evanston, IL 60201
-